<template>
  <div class="addcolor">
    <div class="bg_img">
      <headerNav />
      <searchBar />
    </div>

    <div class="mindWidth flex space-between">
      <information ref="info" />
      <government ref="gover" />
    </div>
    <bannerSwipt />
    <serviceProvider />
    <navigation />
    <footerNav />
  </div>
</template>

<script>
import information from "../../components/home_modules/information.vue"; // 政府政策
import government from "../../components/home_modules/government.vue"; // 政府政策
import bannerSwipt from "../../components/home_modules/banner_swipt.vue"; // 轮播图
import serviceProvider from "../../components/home_modules/serviceProvider.vue"; // 轮播图
import searchBar from "../../components/home_modules/search.vue"; // 搜索框
import { commonRequest } from "../../api/api.js";
import { getToken, removeToken } from "../../util/validate.js";
import { mapActions, mapMutations } from "vuex";
import { get } from "../../http/axios";

export default {
  name: "App",
  components: {
    information,
    bannerSwipt,
    serviceProvider,
    searchBar,
    government
  },
  head() {
    return {
      title: this.title,
      meta: [
        {
          charset: "utf-8"
        },
        {
          name: "baidu-site-verification",
          content: "code-y3syWFTElo"
        },
        {
          hid: "keywords",
          name: "keywords",
          content: this.keywords
        },
        {
          hid: "description",
          name: "description",
          content: this.description
        }
      ]
    };
  },
  data() {
    return {
      getBackgroundImage: {},
      // festivalVisible: true
      title:
        "比目镜-科技产业政策推送查询平台-企业项目申报立项查询网-高新技术企业认定网",
      keywords:
        "比目镜，政策查询，政策智能推送，最新政策，政策解读，政策匹配，政府黄页，企业名单，企业查询，企业项目立项查询，高新技术企业名单查询，高企名单，专利查询，商标查询，专利交易信息发布，高新技术企业认定，科技项目申报",
      description:
        "比目镜(51bmj.cn)，科技产业政策项目数据平台，提供行业扶持资助补贴政策查询、政府部门最新政策实时智能推送、高新技术企业公示名单查询、高新技术企业项目立项查询、高新技术企业荣誉资质查询、高新技术企业商标专利查询、高新技术企业名单统计、科技项目申报查询、政策项目智能匹配、园区孵化器企业查询、政策扶持项目申报服务"
    };
  },
  watch: {
    "$store.state.getHome"(newval, olval) {
      this.$refs.info.getPolicyInfo(0);
      this.$refs.gover.getCityName();
    }
  },
  created() {
    if (url.indexOf("dg.51bmj.cn") > -1) {
      this.title =
        "比目镜东莞-东莞科技产业政策推送查询平台-东莞企业项目申报立项查询网-东莞高新技术企业认定网";
      this.description =
        "比目镜东莞(dg.51bmj.cn)，东莞科技产业政策项目数据平台，提供行业扶持资助补贴政策查询、政府部门最新政策实时智能推送、高新技术企业公示名单查询、高新技术企业项目立项查询、高新技术企业荣誉资质查询、高新技术企业商标专利查询、高新技术企业名单统计、科技项目申报查询、政策项目智能匹配、园区孵化器企业查询、政策扶持项目申报服务";
      this.keywords =
        "比目镜东莞，东莞政策查询，政策智能推送，最新政策，政策解读，政策匹配，政府黄页，企业名单，企业查询，企业项目立项查询，高新技术企业名单查询，高企名单，专利查询，商标查询，专利交易信息发布，高新技术企业认定，科技项目申报";
    }
  },
  mounted() {
    this.getBackground();
    this.init();
  },
  methods: {
    ...mapActions(["getUserInfo"]),
    ...mapMutations(["setToken"]),
    init() {
      let nowTime = +new Date();
      if (localStorage.getItem("endTime") || 0 > nowTime) {
        let token = getToken();
        this.setToken(token);
        this.getUserInfo().then(res => {});
      } else {
        removeToken();
      }
    },
    getBackground() {
      commonRequest("/api/home/getHomeBackgroundConfigInfo").then(res => {
        this.getBackgroundImage = res[0].imageUrl;
      });
    }

    // handleClose() {
    //   this.festivalVisible = false
    // },
    // toFestivalDetail() {
    //   this.festivalVisible = false
    //   window.open("/festival", "_blank");
    // }
  }
};
</script>
<style lang="less" scoped>
.addcolor {
  background-color: #f4f4f4;
  .bg_img {
    width: 100%;
    height: 540px;
    background-color: rgba(0, 0, 0, 0.2);
  }
}
.festival {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  .photo {
    width: 400px;
    height: 250px;
    img {
      width: 400px;
      height: 250px;
      margin-left: 20px;
    }
  }
  .see-btn {
    margin-top: 20px;
    padding: 10px 50px;
    border-radius: 50px;
    color: #ffffff;
    font-size: 18px;
    background: linear-gradient(90deg, #1d6d40, #30855f);
  }
}
</style>
